########## MACROS ###########################################################################
#############################################################################################

function(conan_message MESSAGE_OUTPUT)
    if(NOT CONAN_CMAKE_SILENT_OUTPUT)
        message(${ARGV${0}})
    endif()
endfunction()


macro(conan_find_apple_frameworks FRAMEWORKS_FOUND FRAMEWORKS FRAMEWORKS_DIRS)
    if(APPLE)
        foreach(_FRAMEWORK ${FRAMEWORKS})
            # https://cmake.org/pipermail/cmake-developers/2017-August/030199.html
            find_library(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND NAMES ${_FRAMEWORK} PATHS ${FRAMEWORKS_DIRS} CMAKE_FIND_ROOT_PATH_BOTH)
            if(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND)
                list(APPEND ${FRAMEWORKS_FOUND} ${CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND})
            else()
                message(FATAL_ERROR "Framework library ${_FRAMEWORK} not found in paths: ${FRAMEWORKS_DIRS}")
            endif()
        endforeach()
    endif()
endmacro()


function(conan_package_library_targets libraries package_libdir deps out_libraries out_libraries_target build_type package_name)
    unset(_CONAN_ACTUAL_TARGETS CACHE)
    unset(_CONAN_FOUND_SYSTEM_LIBS CACHE)
    foreach(_LIBRARY_NAME ${libraries})
        find_library(CONAN_FOUND_LIBRARY NAMES ${_LIBRARY_NAME} PATHS ${package_libdir}
                     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
        if(CONAN_FOUND_LIBRARY)
            conan_message(STATUS "Library ${_LIBRARY_NAME} found ${CONAN_FOUND_LIBRARY}")
            list(APPEND _out_libraries ${CONAN_FOUND_LIBRARY})
            if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
                # Create a micro-target for each lib/a found
                string(REGEX REPLACE "[^A-Za-z0-9.+_-]" "_" _LIBRARY_NAME ${_LIBRARY_NAME})
                set(_LIB_NAME CONAN_LIB::${package_name}_${_LIBRARY_NAME}${build_type})
                if(NOT TARGET ${_LIB_NAME})
                    # Create a micro-target for each lib/a found
                    add_library(${_LIB_NAME} UNKNOWN IMPORTED)
                    set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_LOCATION ${CONAN_FOUND_LIBRARY})
                    set(_CONAN_ACTUAL_TARGETS ${_CONAN_ACTUAL_TARGETS} ${_LIB_NAME})
                else()
                    conan_message(STATUS "Skipping already existing target: ${_LIB_NAME}")
                endif()
                list(APPEND _out_libraries_target ${_LIB_NAME})
            endif()
            conan_message(STATUS "Found: ${CONAN_FOUND_LIBRARY}")
        else()
            conan_message(STATUS "Library ${_LIBRARY_NAME} not found in package, might be system one")
            list(APPEND _out_libraries_target ${_LIBRARY_NAME})
            list(APPEND _out_libraries ${_LIBRARY_NAME})
            set(_CONAN_FOUND_SYSTEM_LIBS "${_CONAN_FOUND_SYSTEM_LIBS};${_LIBRARY_NAME}")
        endif()
        unset(CONAN_FOUND_LIBRARY CACHE)
    endforeach()

    if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
        # Add all dependencies to all targets
        string(REPLACE " " ";" deps_list "${deps}")
        foreach(_CONAN_ACTUAL_TARGET ${_CONAN_ACTUAL_TARGETS})
            set_property(TARGET ${_CONAN_ACTUAL_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES "${_CONAN_FOUND_SYSTEM_LIBS};${deps_list}")
        endforeach()
    endif()

    set(${out_libraries} ${_out_libraries} PARENT_SCOPE)
    set(${out_libraries_target} ${_out_libraries_target} PARENT_SCOPE)
endfunction()


########### FOUND PACKAGE ###################################################################
#############################################################################################

include(FindPackageHandleStandardArgs)

conan_message(STATUS "Conan: Using autogenerated FindThrift.cmake")
set(Thrift_FOUND 1)
set(Thrift_VERSION "0.17.0")

find_package_handle_standard_args(Thrift REQUIRED_VARS
                                  Thrift_VERSION VERSION_VAR Thrift_VERSION)
mark_as_advanced(Thrift_FOUND Thrift_VERSION)

set(thrift_COMPONENTS thrift::thriftz thrift::thriftnb thrift::thrift)

if(Thrift_FIND_COMPONENTS)
    foreach(_FIND_COMPONENT ${Thrift_FIND_COMPONENTS})
        list(FIND thrift_COMPONENTS "thrift::${_FIND_COMPONENT}" _index)
        if(${_index} EQUAL -1)
            conan_message(FATAL_ERROR "Conan: Component '${_FIND_COMPONENT}' NOT found in package 'thrift'")
        else()
            conan_message(STATUS "Conan: Component '${_FIND_COMPONENT}' found in package 'thrift'")
        endif()
    endforeach()
endif()

########### VARIABLES #######################################################################
#############################################################################################


set(thrift_INCLUDE_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_INCLUDE_DIR "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_INCLUDES "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_RES_DIRS )
set(thrift_DEFINITIONS )
set(thrift_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)
set(thrift_COMPILE_DEFINITIONS )
set(thrift_COMPILE_OPTIONS_LIST "" "")
set(thrift_COMPILE_OPTIONS_C "")
set(thrift_COMPILE_OPTIONS_CXX "")
set(thrift_LIBRARIES_TARGETS "") # Will be filled later, if CMake 3
set(thrift_LIBRARIES "") # Will be filled later
set(thrift_LIBS "") # Same as thrift_LIBRARIES
set(thrift_SYSTEM_LIBS m pthread)
set(thrift_FRAMEWORK_DIRS )
set(thrift_FRAMEWORKS )
set(thrift_FRAMEWORKS_FOUND "") # Will be filled later
set(thrift_BUILD_MODULES_PATHS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/lib/cmake/conan-official-thrift-targets.cmake")

conan_find_apple_frameworks(thrift_FRAMEWORKS_FOUND "${thrift_FRAMEWORKS}" "${thrift_FRAMEWORK_DIRS}")

mark_as_advanced(thrift_INCLUDE_DIRS
                 thrift_INCLUDE_DIR
                 thrift_INCLUDES
                 thrift_DEFINITIONS
                 thrift_LINKER_FLAGS_LIST
                 thrift_COMPILE_DEFINITIONS
                 thrift_COMPILE_OPTIONS_LIST
                 thrift_LIBRARIES
                 thrift_LIBS
                 thrift_LIBRARIES_TARGETS)

# Find the real .lib/.a and add them to thrift_LIBS and thrift_LIBRARY_LIST
set(thrift_LIBRARY_LIST thriftz thriftnb thrift)
set(thrift_LIB_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/lib")

# Gather all the libraries that should be linked to the targets (do not touch existing variables):
set(_thrift_DEPENDENCIES "${thrift_FRAMEWORKS_FOUND} ${thrift_SYSTEM_LIBS} ZLIB::ZLIB;libevent::libevent;Boost::headers;OpenSSL::OpenSSL")

conan_package_library_targets("${thrift_LIBRARY_LIST}"  # libraries
                              "${thrift_LIB_DIRS}"      # package_libdir
                              "${_thrift_DEPENDENCIES}"  # deps
                              thrift_LIBRARIES            # out_libraries
                              thrift_LIBRARIES_TARGETS    # out_libraries_targets
                              ""                          # build_type
                              "thrift")                                      # package_name

set(thrift_LIBS ${thrift_LIBRARIES})

foreach(_FRAMEWORK ${thrift_FRAMEWORKS_FOUND})
    list(APPEND thrift_LIBRARIES_TARGETS ${_FRAMEWORK})
    list(APPEND thrift_LIBRARIES ${_FRAMEWORK})
endforeach()

foreach(_SYSTEM_LIB ${thrift_SYSTEM_LIBS})
    list(APPEND thrift_LIBRARIES_TARGETS ${_SYSTEM_LIB})
    list(APPEND thrift_LIBRARIES ${_SYSTEM_LIB})
endforeach()

# We need to add our requirements too
set(thrift_LIBRARIES_TARGETS "${thrift_LIBRARIES_TARGETS};ZLIB::ZLIB;libevent::libevent;Boost::headers;OpenSSL::OpenSSL")
set(thrift_LIBRARIES "${thrift_LIBRARIES};ZLIB::ZLIB;libevent::libevent;Boost::headers;OpenSSL::OpenSSL")

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})


########### COMPONENT thrift VARIABLES #############################################

set(thrift_thrift_INCLUDE_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thrift_INCLUDE_DIR "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thrift_INCLUDES "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thrift_LIB_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/lib")
set(thrift_thrift_RES_DIRS )
set(thrift_thrift_DEFINITIONS )
set(thrift_thrift_COMPILE_DEFINITIONS )
set(thrift_thrift_COMPILE_OPTIONS_C "")
set(thrift_thrift_COMPILE_OPTIONS_CXX "")
set(thrift_thrift_LIBS thrift)
set(thrift_thrift_SYSTEM_LIBS m pthread)
set(thrift_thrift_FRAMEWORK_DIRS )
set(thrift_thrift_FRAMEWORKS )
set(thrift_thrift_BUILD_MODULES_PATHS )
set(thrift_thrift_DEPENDENCIES Boost::headers OpenSSL::OpenSSL)
set(thrift_thrift_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)

########### COMPONENT thriftnb VARIABLES #############################################

set(thrift_thriftnb_INCLUDE_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thriftnb_INCLUDE_DIR "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thriftnb_INCLUDES "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thriftnb_LIB_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/lib")
set(thrift_thriftnb_RES_DIRS )
set(thrift_thriftnb_DEFINITIONS )
set(thrift_thriftnb_COMPILE_DEFINITIONS )
set(thrift_thriftnb_COMPILE_OPTIONS_C "")
set(thrift_thriftnb_COMPILE_OPTIONS_CXX "")
set(thrift_thriftnb_LIBS thriftnb)
set(thrift_thriftnb_SYSTEM_LIBS )
set(thrift_thriftnb_FRAMEWORK_DIRS )
set(thrift_thriftnb_FRAMEWORKS )
set(thrift_thriftnb_BUILD_MODULES_PATHS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/lib/cmake/conan-official-thrift-targets.cmake")
set(thrift_thriftnb_DEPENDENCIES thrift::thrift libevent::libevent)
set(thrift_thriftnb_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)

########### COMPONENT thriftz VARIABLES #############################################

set(thrift_thriftz_INCLUDE_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thriftz_INCLUDE_DIR "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thriftz_INCLUDES "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/include")
set(thrift_thriftz_LIB_DIRS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/lib")
set(thrift_thriftz_RES_DIRS )
set(thrift_thriftz_DEFINITIONS )
set(thrift_thriftz_COMPILE_DEFINITIONS )
set(thrift_thriftz_COMPILE_OPTIONS_C "")
set(thrift_thriftz_COMPILE_OPTIONS_CXX "")
set(thrift_thriftz_LIBS thriftz)
set(thrift_thriftz_SYSTEM_LIBS )
set(thrift_thriftz_FRAMEWORK_DIRS )
set(thrift_thriftz_FRAMEWORKS )
set(thrift_thriftz_BUILD_MODULES_PATHS "/root/.conan/data/thrift/0.17.0/_/_/package/249bff54fc55cab7da11f255d70827c83fc2b2b4/lib/cmake/conan-official-thrift-targets.cmake")
set(thrift_thriftz_DEPENDENCIES thrift::thrift ZLIB::ZLIB)
set(thrift_thriftz_LINKER_FLAGS_LIST
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
        "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)


########## FIND PACKAGE DEPENDENCY ##########################################################
#############################################################################################

include(CMakeFindDependencyMacro)

if(NOT ZLIB_FOUND)
    find_dependency(ZLIB REQUIRED)
else()
    conan_message(STATUS "Conan: Dependency ZLIB already found")
endif()

if(NOT Libevent_FOUND)
    find_dependency(Libevent REQUIRED)
else()
    conan_message(STATUS "Conan: Dependency Libevent already found")
endif()

if(NOT Boost_FOUND)
    find_dependency(Boost REQUIRED)
else()
    conan_message(STATUS "Conan: Dependency Boost already found")
endif()

if(NOT OpenSSL_FOUND)
    find_dependency(OpenSSL REQUIRED)
else()
    conan_message(STATUS "Conan: Dependency OpenSSL already found")
endif()


########## FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #######################################
#############################################################################################

########## COMPONENT thrift FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #############

set(thrift_thrift_FRAMEWORKS_FOUND "")
conan_find_apple_frameworks(thrift_thrift_FRAMEWORKS_FOUND "${thrift_thrift_FRAMEWORKS}" "${thrift_thrift_FRAMEWORK_DIRS}")

set(thrift_thrift_LIB_TARGETS "")
set(thrift_thrift_NOT_USED "")
set(thrift_thrift_LIBS_FRAMEWORKS_DEPS ${thrift_thrift_FRAMEWORKS_FOUND} ${thrift_thrift_SYSTEM_LIBS} ${thrift_thrift_DEPENDENCIES})
conan_package_library_targets("${thrift_thrift_LIBS}"
                              "${thrift_thrift_LIB_DIRS}"
                              "${thrift_thrift_LIBS_FRAMEWORKS_DEPS}"
                              thrift_thrift_NOT_USED
                              thrift_thrift_LIB_TARGETS
                              ""
                              "thrift_thrift")

set(thrift_thrift_LINK_LIBS ${thrift_thrift_LIB_TARGETS} ${thrift_thrift_LIBS_FRAMEWORKS_DEPS})

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})

########## COMPONENT thriftnb FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #############

set(thrift_thriftnb_FRAMEWORKS_FOUND "")
conan_find_apple_frameworks(thrift_thriftnb_FRAMEWORKS_FOUND "${thrift_thriftnb_FRAMEWORKS}" "${thrift_thriftnb_FRAMEWORK_DIRS}")

set(thrift_thriftnb_LIB_TARGETS "")
set(thrift_thriftnb_NOT_USED "")
set(thrift_thriftnb_LIBS_FRAMEWORKS_DEPS ${thrift_thriftnb_FRAMEWORKS_FOUND} ${thrift_thriftnb_SYSTEM_LIBS} ${thrift_thriftnb_DEPENDENCIES})
conan_package_library_targets("${thrift_thriftnb_LIBS}"
                              "${thrift_thriftnb_LIB_DIRS}"
                              "${thrift_thriftnb_LIBS_FRAMEWORKS_DEPS}"
                              thrift_thriftnb_NOT_USED
                              thrift_thriftnb_LIB_TARGETS
                              ""
                              "thrift_thriftnb")

set(thrift_thriftnb_LINK_LIBS ${thrift_thriftnb_LIB_TARGETS} ${thrift_thriftnb_LIBS_FRAMEWORKS_DEPS})

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})

########## COMPONENT thriftz FIND LIBRARIES & FRAMEWORKS / DYNAMIC VARS #############

set(thrift_thriftz_FRAMEWORKS_FOUND "")
conan_find_apple_frameworks(thrift_thriftz_FRAMEWORKS_FOUND "${thrift_thriftz_FRAMEWORKS}" "${thrift_thriftz_FRAMEWORK_DIRS}")

set(thrift_thriftz_LIB_TARGETS "")
set(thrift_thriftz_NOT_USED "")
set(thrift_thriftz_LIBS_FRAMEWORKS_DEPS ${thrift_thriftz_FRAMEWORKS_FOUND} ${thrift_thriftz_SYSTEM_LIBS} ${thrift_thriftz_DEPENDENCIES})
conan_package_library_targets("${thrift_thriftz_LIBS}"
                              "${thrift_thriftz_LIB_DIRS}"
                              "${thrift_thriftz_LIBS_FRAMEWORKS_DEPS}"
                              thrift_thriftz_NOT_USED
                              thrift_thriftz_LIB_TARGETS
                              ""
                              "thrift_thriftz")

set(thrift_thriftz_LINK_LIBS ${thrift_thriftz_LIB_TARGETS} ${thrift_thriftz_LIBS_FRAMEWORKS_DEPS})

set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH  ${CMAKE_PREFIX_PATH})


########## TARGETS ##########################################################################
#############################################################################################

########## COMPONENT thrift TARGET #################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    # Target approach
    if(NOT TARGET thrift::thrift)
        add_library(thrift::thrift INTERFACE IMPORTED)
        set_target_properties(thrift::thrift PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                              "${thrift_thrift_INCLUDE_DIRS}")
        set_target_properties(thrift::thrift PROPERTIES INTERFACE_LINK_DIRECTORIES
                              "${thrift_thrift_LIB_DIRS}")
        set_target_properties(thrift::thrift PROPERTIES INTERFACE_LINK_LIBRARIES
                              "${thrift_thrift_LINK_LIBS};${thrift_thrift_LINKER_FLAGS_LIST}")
        set_target_properties(thrift::thrift PROPERTIES INTERFACE_COMPILE_DEFINITIONS
                              "${thrift_thrift_COMPILE_DEFINITIONS}")
        set_target_properties(thrift::thrift PROPERTIES INTERFACE_COMPILE_OPTIONS
                              "${thrift_thrift_COMPILE_OPTIONS_C};${thrift_thrift_COMPILE_OPTIONS_CXX}")
    endif()
endif()

########## COMPONENT thriftnb TARGET #################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    # Target approach
    if(NOT TARGET thrift::thriftnb)
        add_library(thrift::thriftnb INTERFACE IMPORTED)
        set_target_properties(thrift::thriftnb PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                              "${thrift_thriftnb_INCLUDE_DIRS}")
        set_target_properties(thrift::thriftnb PROPERTIES INTERFACE_LINK_DIRECTORIES
                              "${thrift_thriftnb_LIB_DIRS}")
        set_target_properties(thrift::thriftnb PROPERTIES INTERFACE_LINK_LIBRARIES
                              "${thrift_thriftnb_LINK_LIBS};${thrift_thriftnb_LINKER_FLAGS_LIST}")
        set_target_properties(thrift::thriftnb PROPERTIES INTERFACE_COMPILE_DEFINITIONS
                              "${thrift_thriftnb_COMPILE_DEFINITIONS}")
        set_target_properties(thrift::thriftnb PROPERTIES INTERFACE_COMPILE_OPTIONS
                              "${thrift_thriftnb_COMPILE_OPTIONS_C};${thrift_thriftnb_COMPILE_OPTIONS_CXX}")
    endif()
endif()

########## COMPONENT thriftz TARGET #################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    # Target approach
    if(NOT TARGET thrift::thriftz)
        add_library(thrift::thriftz INTERFACE IMPORTED)
        set_target_properties(thrift::thriftz PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                              "${thrift_thriftz_INCLUDE_DIRS}")
        set_target_properties(thrift::thriftz PROPERTIES INTERFACE_LINK_DIRECTORIES
                              "${thrift_thriftz_LIB_DIRS}")
        set_target_properties(thrift::thriftz PROPERTIES INTERFACE_LINK_LIBRARIES
                              "${thrift_thriftz_LINK_LIBS};${thrift_thriftz_LINKER_FLAGS_LIST}")
        set_target_properties(thrift::thriftz PROPERTIES INTERFACE_COMPILE_DEFINITIONS
                              "${thrift_thriftz_COMPILE_DEFINITIONS}")
        set_target_properties(thrift::thriftz PROPERTIES INTERFACE_COMPILE_OPTIONS
                              "${thrift_thriftz_COMPILE_OPTIONS_C};${thrift_thriftz_COMPILE_OPTIONS_CXX}")
    endif()
endif()

########## GLOBAL TARGET ####################################################################

if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
    if(NOT TARGET thrift::thrift)
        add_library(thrift::thrift INTERFACE IMPORTED)
    endif()
    set_property(TARGET thrift::thrift APPEND PROPERTY
                 INTERFACE_LINK_LIBRARIES "${thrift_COMPONENTS}")
endif()

########## BUILD MODULES ####################################################################
#############################################################################################
########## COMPONENT thrift BUILD MODULES ##########################################

foreach(_BUILD_MODULE_PATH ${thrift_thrift_BUILD_MODULES_PATHS})
    include(${_BUILD_MODULE_PATH})
endforeach()
########## COMPONENT thriftnb BUILD MODULES ##########################################

foreach(_BUILD_MODULE_PATH ${thrift_thriftnb_BUILD_MODULES_PATHS})
    include(${_BUILD_MODULE_PATH})
endforeach()
########## COMPONENT thriftz BUILD MODULES ##########################################

foreach(_BUILD_MODULE_PATH ${thrift_thriftz_BUILD_MODULES_PATHS})
    include(${_BUILD_MODULE_PATH})
endforeach()
